home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / CAppendiceContributiViewer.as < prev    next >
Text File  |  2007-11-08  |  6KB  |  188 lines

  1. class CAppendiceContributiViewer extends mx.core.UIObject
  2. {
  3.    function CAppendiceContributiViewer()
  4.    {
  5.       super();
  6.       this.Hide();
  7.       this.doLater(this,"init");
  8.    }
  9.    function init(Void)
  10.    {
  11.       this.mMarginRect = new Object();
  12.       this.mMarginRect.top = 70;
  13.       this.mMarginRect.left = 50;
  14.       this.mMarginRect.bottom = 50;
  15.       this.mMarginRect.right = 50;
  16.       this.mMaxZoom = 200;
  17.       this.mMinZoom = 25;
  18.       this.mc_ImageOrgRect = new Object();
  19.       this.mc_ImageOrgRect.x = this.mc_Image._x;
  20.       this.mc_ImageOrgRect.y = this.mc_Image._y;
  21.       this.mc_ImageOrgRect.width = this.mc_Image.width;
  22.       this.mc_ImageOrgRect.height = this.mc_Image.height;
  23.       this.mGrabAlpha = 10;
  24.       this.mc_BtnTornaARicerca.addEventListener("click",mx.utils.Delegate.create(this,this.Back));
  25.       this.mc_CbtnZoomImage.SetCallBack(this,this.onZoomImage);
  26.       this.mc_Image.addEventListener("progress",mx.utils.Delegate.create(this,this.onImageLoadingProgress));
  27.       this.mc_Image.addEventListener("complete",mx.utils.Delegate.create(this,this.onImageLoadingComplete));
  28.       this.mc_Image.setStyle("borderStyle","none");
  29.       this.mc_Image.__set__scaleContent(true);
  30.       this.mc_Titolo.html = true;
  31.       this.mc_Titolo.embedFonts = _global.gUseEmbeddedFont;
  32.       this.mc_Titolo.styleSheet = _global.gStyleManager.GetCSS();
  33.       this.mc_LblTipo.html = true;
  34.       this.mc_Dida.__set__html(true);
  35.       this.mc_Dida.embedFonts = _global.gUseEmbeddedFont;
  36.       this.mc_Dida.__set__styleSheet(_global.gStyleManager.GetCSS());
  37.       this.mc_Dida.setStyle("borderStyle","none");
  38.       this.mc_Dida.setVScrollPolicy("on");
  39.       this.mc_ImgIcona.setStyle("borderStyle","none");
  40.       this.mc_Progress._visible = false;
  41.       this.mc_Sfondo.onPress = this.ClickGrab;
  42.       this.mc_Sfondo.useHandCursor = false;
  43.       this.mc_TitoloRollover.onRollOver = mx.utils.Delegate.create(this,this.onTitleRollOver);
  44.       this.mc_TitoloRollover.onRollOut = mx.utils.Delegate.create(this,this.onTitleRollOut);
  45.       this.mc_TitoloRollover.onDragOut = mx.utils.Delegate.create(this,this.onTitleRollOut);
  46.    }
  47.    function ClickGrab()
  48.    {
  49.    }
  50.    function LayoutWindow()
  51.    {
  52.       this.mc_Progress._visible = false;
  53.       var _loc2_ = {x:0,y:0};
  54.       this.globalToLocal(_loc2_);
  55.       this.mc_GrabRect._x = _loc2_.x;
  56.       this.mc_GrabRect._y = _loc2_.y;
  57.       this.mc_GrabRect._width = Stage.width;
  58.       this.mc_GrabRect._height = Stage.height;
  59.       this.mc_GrabRect.onPress = function()
  60.       {
  61.          this._parent.NextFrame();
  62.       };
  63.       this.mc_GrabRect.useHandCursor = false;
  64.       this.mc_GrabRect._alpha = this.mGrabAlpha;
  65.       this.mc_GrabRect._visible = true;
  66.    }
  67.    function MostraContributo(inContributo, inFrom)
  68.    {
  69.       this.mContributo = inContributo;
  70.       this.mc_BtnTornaARicerca.SetState(inFrom);
  71.       this.LayoutWindow();
  72.       this.mc_Titolo.htmlText = "<span class=\'s_titoloContributo\'>" + inContributo.mTitolo + "</span>";
  73.       this.mc_Titolo.hscroll = 0;
  74.       this.mc_Dida.__set__text("<span class=\'s_didaContributo\'>" + inContributo.mDida + "</span>");
  75.       this.mc_Image.__set__contentPath(inContributo.GetPath());
  76.       this.HandleIcon(inContributo);
  77.       var _loc3_ = inContributo.GetPath();
  78.       if(_loc3_ != this.mc_Image.__get__contentPath())
  79.       {
  80.          this.mc_Image.__set__contentPath(_loc3_);
  81.          this.mc_Progress.SetProgress(0);
  82.          this.mc_Progress._visible = true;
  83.       }
  84.       else
  85.       {
  86.          this.mc_Progress._visible = false;
  87.       }
  88.       if(inContributo.mStatus != undefined && inContributo.mStatus != null)
  89.       {
  90.          this.SetStatus(inContributo.mStatus);
  91.       }
  92.       this._visible = true;
  93.       this.dispatchEvent({type:"onXXIWindowMessage",target:this,windowName:"contributi",action:"open"});
  94.    }
  95.    function SetStatus(inStatus)
  96.    {
  97.    }
  98.    function HandleIcon(inContributo)
  99.    {
  100.       if(inContributo.mTipo == "F" || inContributo.mTipo == "I")
  101.       {
  102.          this.mc_ImgIcona.__set__contentPath("imageIconBig");
  103.          this.mc_LblTipo.text = "Foto";
  104.       }
  105.       else if(inContributo.mTipo == "T")
  106.       {
  107.          this.mc_ImgIcona.__set__contentPath("tabIconBig");
  108.          this.mc_LblTipo.text = "Tabella";
  109.       }
  110.       else if(inContributo.mTipo == "P")
  111.       {
  112.          this.mc_ImgIcona.__set__contentPath("prospIconBig");
  113.          this.mc_LblTipo.text = "";
  114.       }
  115.       else
  116.       {
  117.          this.mc_ImgIcona.__set__contentPath("emptyIcon");
  118.          this.mc_LblTipo.text = "";
  119.       }
  120.    }
  121.    function Hide(Void)
  122.    {
  123.       this._visible = false;
  124.    }
  125.    function Close(Void)
  126.    {
  127.       this.Hide();
  128.       this.dispatchEvent({type:"onXXIWindowMessage",target:this,windowName:"contributi",action:"close"});
  129.    }
  130.    function onZoomImage()
  131.    {
  132.       if(_root.gAppendiceSearch)
  133.       {
  134.          _root.gAppendiceSearch.OpenZoomWindow(this.mContributo,"contributi");
  135.       }
  136.    }
  137.    function onImageLoadingProgress(eventObject)
  138.    {
  139.       this.mc_Progress.SetProgress(this.mc_Image.__get__percentLoaded());
  140.    }
  141.    function onImageLoadingComplete(eventObject)
  142.    {
  143.       this.mc_Progress.SetProgress(100);
  144.       this.mc_Progress._visible = false;
  145.    }
  146.    function Copy()
  147.    {
  148.    }
  149.    function Print()
  150.    {
  151.       var _loc3_ = false;
  152.       if(_global.gPrint)
  153.       {
  154.          if(this.mc_Image.__get__percentLoaded() >= 100)
  155.          {
  156.             _global.gPrint.PrintImage(this.mc_Titolo.htmlText,this.mc_Dida.__get__text(),this.mc_Image.__get__contentPath());
  157.          }
  158.          else
  159.          {
  160.             _global.gAlert.ShowAlert("","Impossible stampare: il contributo non ├¿ stato del tutto scaricato","OK",10);
  161.          }
  162.       }
  163.       return _loc3_;
  164.    }
  165.    function Save()
  166.    {
  167.    }
  168.    function setEnabled(enable)
  169.    {
  170.    }
  171.    function Back(Void)
  172.    {
  173.       this.Close();
  174.       if(_root.gAppendiceSearch)
  175.       {
  176.          _root.gAppendiceSearch.Back();
  177.       }
  178.    }
  179.    function onTitleRollOver()
  180.    {
  181.       _root.gTooltipManager.show(this.mc_Titolo.htmlText,null);
  182.    }
  183.    function onTitleRollOut()
  184.    {
  185.       _root.gTooltipManager.hide();
  186.    }
  187. }
  188.